<template>
	<view class="home">
		<view class="item" style="border-top: 1px solid #C0C4CC;" @click="nav_personal">
			<text class="personal">个人信息</text>
			<view class="flex-1"></view>
			<text class="info">头像、昵称</text>
			<text class="iconfont icon-jiantou direction"></text>
		</view>
		<view class="item" style="" @click="nav_security">
			<text class="personal">账号与安全</text>
			<view class="flex-1"></view>
			<text class="info">修改手机号、账号绑定管理</text>
			<view class="iconfont icon-jiantou direction" style=""></view>
		</view>
		<view class="item" style="">
			<text class="personal">
				关于智慧跑腿
			</text>
			<view class="flex-1"></view>
			<text class="iconfont icon-jiantou direction"></text>
		</view>

		<button type="primary" style="margin-top: 100px;" @click="Sign_out">退出登录</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				number: '',
				if_personal: '',
				if_runner: '',
				name: ''
			}
		},
		methods: {
			Sign_out() {
				uni.showModal({
					title: '温馨提示',
					content: '您确定退出登录嘛？',
					success: (res) => {
						if (res.confirm) {
							uni.$emit('Sgin_Out');
							uni.switchTab({
								url: '../../pages/personal_center/personal_center'
							})
							try {
								uni.setStorageSync('userInfo','{}');
								this.User= JSON.parse(uni.getStorageSync('userInfo') || '{}') ;
								console.log(this.User)
						
							} catch (e) {
							    // error
							}
						} else if (res.cancel) {
							console.log('用户点击了取消');
						}
					}
				})
			},
			nav_personal() {
				uni.navigateTo({
					url: `../../pagesE/personal_info/personal_info?number=${this.number}&if_personal=${this.if_personal}&if_runner=${this.if_runner}&Int_name=${this.name}`,
					success() {
						console.log('成功导航到个人信息页面')
					}
				})
			},
			nav_security() {
				uni.navigateTo({
					url: '../../pagesE/Security_center/Security_center',
					success() {
						console.log('成功导航到个人安全页面')
					}
				})
			}
		},
		onLoad(options) {
			this.number = options.number;
			this.if_personal = options.if_personal;
			this.if_runner = options.if_runner;
			this.name = options.Int_name;
		}
	}
</script>

<style lang="scss">
	.home {
		font-size: 30rpx;
		width: 100%;
		.flex-1{
			flex: 1;
		}
		.item {
			box-sizing: border-box;
			display: flex;
			padding: 0 20rpx;
			line-height: 140rpx;
			border-bottom: 1px solid #C0C4CC;
			.personal {
				text-align: center;
				height: 140rpx;
				font-weight: 700;
			}

			.info {
				font-size: 28rpx;
				padding-right: 20rpx;
				color: #C0C0C0;
			}
			.direction {
				font-size: 42rpx;
			}
		}
		button{
			position: fixed;
			bottom: 80rpx;
			left:50%;
			font-size: 32rpx;
			transform: translateX(-50%);
			background-color: $main-color;
			width: 90%;
		}
		button::after{
			border: none;
		}
	}
</style>
